package com.byb.server.service.mapper;

import com.byb.server.domain.*;
import com.byb.server.service.dto.ClaimsInstructionDTO;

import org.mapstruct.*;

/**
 * Mapper for the entity ClaimsInstruction and its DTO ClaimsInstructionDTO.
 */
@Mapper(componentModel = "spring", uses = {ProductMapper.class, })
public interface ClaimsInstructionMapper extends EntityMapper <ClaimsInstructionDTO, ClaimsInstruction> {

    @Mapping(source = "product.id", target = "productId")
    ClaimsInstructionDTO toDto(ClaimsInstruction claimsInstruction); 

    @Mapping(source = "productId", target = "product")
    ClaimsInstruction toEntity(ClaimsInstructionDTO claimsInstructionDTO); 
    default ClaimsInstruction fromId(Long id) {
        if (id == null) {
            return null;
        }
        ClaimsInstruction claimsInstruction = new ClaimsInstruction();
        claimsInstruction.setId(id);
        return claimsInstruction;
    }
}
